#!/bin/bash
# see: dh_installdeb(1)

set -e

# Source debconf library.
. /usr/share/debconf/confmodule

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

echo "Entering postint" >> /tmp/log

function check_db_answers {
	db_get test4debconf/like_lliurex
	if [ "$RET" = "false" ]; then
	    echo "You response you  don't like lliurex at `date`" >> /tmp/likeLliureX
	else
            echo "You response you  LIKE lliurex at `date`. Have a good day." >> /tmp/likeLliureX
	fi
}

case "$1" in
 	# install | upgrade ) si és la instalacio o actualitzacio
    configure)
	echo "going to get answers" >> /tmp/log
	check_db_answers
	echo "finished getting answers" >> /tmp/log
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
